package com.lagouedu.demoredis.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.JedisCluster;

@RestController
public class RedisController {

    @Autowired
    private JedisCluster jedisCluster;

    @RequestMapping("/redis/set")
    public  String set(String key, String value){
        jedisCluster.set(key,value);
        return "key: "+ key + "value: " + value;
    }

    @RequestMapping("/redis/get")
    public String get(String key){
        return jedisCluster.get(key);
    }
}
